<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/draw/drawBase.js"></script>
  </head>
  <body>
  <!-- <div id="toolbar" style="padding:2px;">
    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="admin.drawBase.toAdd();">添加</a>
</div> -->
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
	            <dl>
	                <dt>适用范围：</dt>
	                <dd>
	                	<select name="rangeType" id="rangeType" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                		<option value="1">平台抽奖</option>
	                		<option value="2">社区抽奖</option>
	                	</select>
	                </dd>
	            </dl>
	            <dl>
	                <dt>状态：</dt>
	                <dd>
	                	<select name="status" id="status" class="txt grid-8">
	                		<option value="">--请选择--</option>
	                		<option value="1">正常</option>
	                		<option value="2">已停止</option>
	                	</select>
	                </dd>
	            </dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.drawBase.query()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/draw/base/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'name',width:150,align:'center'">名称</th>
						<th data-options="field:'remark',width:150,align:'center' ">描述</th>
						<th data-options="field:'type',width:100,align:'center',formatter:formatType">类型</th>
						<th data-options="field:'rangeType',width:100,align:'center',formatter:formatRangeType">适用范围</th>
						<th data-options="field:'communityName',width:150,align:'center' ">抽奖社区</th>
						<th data-options="field:'strStartAt',width:150,align:'center' ">开始时间</th>
						<th data-options="field:'strEndAt',width:150,align:'center' ">结束时间</th>
						<th data-options="field:'strUpdAt',width:150,align:'center' ">最后修改时间</th>
						<th data-options="field:'strNewAt',width:150,align:'center' ">创建时间</th>
			            <th data-options="field:'id',align:'center',width:150,formatter:formatOperation">管理操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>
	<script>
		function formatOperation(value,row,index) {
			var l_html = '';
			l_html += '<a href="javascript:;" class="table_link" onclick="admin.drawBase.detail('+row.id+')">查看</a>';
			l_html += '<a href="javascript:;" class="table_link" onclick="admin.drawBase.toUpdate('+row.id+')">编辑</a>';
			if(row.status==1){
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.drawBase.down('+row.id+')">停止</a>';
			}else{
				l_html += '<a href="javascript:;" class="table_link" onclick="admin.drawBase.up('+row.id+')">开启</a>';
			}
			return l_html;
		}
		function formatType(value,row,index) {
			var type = row.type;
			if(type=="1"){
				return '社区活动';
			}else if(type=="2"){
				return '圈子活动';
			}else if(type=="3"){
				return '其他';
			}
		}
		function formatRangeType(value,row,index) {
			var rangeType = row.rangeType;
			if(rangeType=="1"){
				return '平台抽奖(通用)';
			}else if(rangeType=="2"){
				return '社区抽奖';
			}
		}
	</script>
  </body>
</html>
